package com.tarena.shoot;
import java.util.Random;
/**小蜜蜂:是飞行物也是奖励*/
public class Bee extends FlyingObject implements Award{
	private int xSpeed = 1;	//x坐标走步速度
	private int ySpeed = 2;	//y坐标走步速度
	private int awardType;	//奖励类型
	/**构造方法*/
	public Bee() {
		image = ShootGame.bee;
		width = image.getWidth();
		height = image.getHeight();
		Random rand = new Random();
		x = rand.nextInt(ShootGame.WIDTH - width);
		y = -height;
		awardType = rand.nextInt(2);
	}
	
	public int getType() {		
		return awardType;
	}
	
	public void step() {
		y += ySpeed;
		x += xSpeed;
		if(x >= ShootGame.WIDTH - width) {
			xSpeed = -1;
		}
		if(x <= 0) {
			xSpeed = 1;
		}
	}
	
	public boolean outOfBounds() {
		return y > ShootGame.HEIGHT;
	}
}
